//
//  PABankCardInfo.m
//  PAMobileWallet
//
//  Created by Gavin Zhang on 7/14/13.
//  Copyright (c) 2013 平安付. All rights reserved.
//

#import "PABankCardInfo.h"

@implementation PABankCardInfo

@synthesize bankId                      = _bankId;
@synthesize bankName                    = _bankName;
@synthesize bankMark                    = _bankMark;
@synthesize bankCardId                  = _bankCardId;
@synthesize bankCardType                = _bankCardType;
@synthesize bankCardNum                 = _bankCardNum;

- (id)initWithDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        if ([dic objectForKey:k_bankCardNum]) self.bankCardNum = [dic objectForKey:k_bankCardNum];
        if ([dic objectForKey:k_bankId]) self.bankId = [dic objectForKey:k_bankId];
        if ([dic objectForKey:k_bankCardType]) self.bankCardType = [[dic objectForKey:k_bankCardType] integerValue];
        if ([dic objectForKey:k_bankCardId]) self.bankCardId = [dic objectForKey:k_bankCardId];
        if ([dic objectForKey:k_bankName]) self.bankName = [dic objectForKey:k_bankName];
        if ([dic objectForKey:k_bankMark]) self.bankMark = [dic objectForKey:k_bankMark];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:_bankId forKey:@"bankId"];
    [aCoder encodeObject:_bankName forKey:@"bankName"];
    [aCoder encodeObject:_bankMark forKey:@"bankMark"];
    [aCoder encodeObject:_bankCardId forKey:@"bankCardId"];
    [aCoder encodeInteger:_bankCardType forKey:@"bankCardType"];
    [aCoder encodeObject:_bankCardNum forKey:@"bankCardNum"];
}

- (id)initWithCoder:(NSCoder *)aDecoder{
    self = [super init];
    if (self) {
        _bankId         = [aDecoder decodeObjectForKey:@"bankId"];
        _bankName       = [aDecoder decodeObjectForKey:@"bankName"];
        _bankMark       = [aDecoder decodeObjectForKey:@"bankMark"];;
        _bankCardId     = [aDecoder decodeObjectForKey:@"bankCardId"];;
        _bankCardType   = [aDecoder decodeIntegerForKey:@"bankCardType"];;
        _bankCardNum    = [aDecoder decodeObjectForKey:@"bankCardNum"];;
    }
    return self;
}


@end
